package com.code.monitor.utils;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class DateUtils {
    public static final String DATE_PATTERN_YYYYMMDD = "yyyyMMdd";
    public static final String DATE_PATTERN_YYYYMMDDHHMMSS = "yyyyMMddHHmmss";

    public static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DATE_PATTERN_YYYYMMDD);

    public DateUtils() {
    }

    /**
     * 获取当前日期的年月日格式
     *
     * @return
     */
    public static String getYMDHMSDate() {
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN_YYYYMMDDHHMMSS);
        return sdf.format(new Date());
    }

    /**
     * 获取当前日期的年月日格式
     *
     * @return
     */
    public static String getYMDDate() {
        return dateTimeFormatter.format(LocalDateTime.now());
    }


    public static void main(String[] args) throws IOException {
//        System.out.println(getYMDDate());
        System.out.println(UUIDUtils.uploadId());
    }
}
